<?php
set_time_limit(0);
if (isset($_POST['vtd']) && isset($_POST['tm'])){
    include '../c/config.php';
    $id=substr(trim($_POST['vtd']), 3);
    
    
    file_put_contents('../data/tm/'.$id.'-duo.txt', json_encode($_POST['tm'], JSON_UNESCAPED_UNICODE));
    
    
    $mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
    if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqli->error);}
   
    $mysqli->query("INSERT INTO `duoxuan` (`id`, `uid`, `yhtj`,`createtime`) VALUES (NULL,'".$id."', '".json_encode($_POST['tm'], JSON_UNESCAPED_UNICODE)."', '".date("Y-m-d H:i:s")."')");
    $mysqli->close();
    echo json_encode(array('s'=>'y'));
}else{
    echo json_encode(array('s'=>'n'));
}

?>